#ifndef SELECTCLASS_H
#define SELECTCLASS_H

#include <QDialog>
#include <QSqlTableModel>
#include <QListWidgetItem>
#include <QCompleter>
#include <QMessageBox>
#include <QSqlRecord>
#include <QSqlQuery>
#include <QString>
#include <QAbstractItemView>
#include <QSqlRecord>

typedef struct TrieNode
{
    int cnt;                   //统计各个单词出现的次数 初始化为0(在插入单词最后一个字母所在的结点才+1)
    struct TrieNode *next[10]; //假设单词只有数字
}TrieNode,*LinkTrie;

namespace Ui {
class SelectClass;
}

class SelectClass : public QDialog
{
    Q_OBJECT

public:
    explicit SelectClass(QWidget *parent = 0);
    ~SelectClass();
    bool isNumber(char* str);
    LinkTrie create();
    int insert(LinkTrie R, char *str);
    void destroy(LinkTrie R);
    void prefix(LinkTrie R, char *word);
    void prefixTraverse(LinkTrie tempNode, char *str, int j);

private slots:
    void on_number_textChanged(const QString &arg1);
    void on_listWidget_itemClicked(QListWidgetItem *item);
    void on_selectClass_clicked();
    void on_number_editingFinished();
    void on_sure_clicked();
    void on_pushButton_clicked();
    void on_deleteClass_clicked();

private:
    Ui::SelectClass *ui;
    QSqlTableModel *modelMyClass;
    QSqlTableModel *modelSelectClass;
};

#endif // SELECTCLASS_H
